import React from 'react';

import Constants from '../../common/Constants';
import CommonSendFetchAction from '../common/CommonSendFetchAction';
import ToastUtils from '../../common/ToastUtils';
import ResponseConstants from '../../common/ResponseConstants';

export default class JifenMallChoujiangAction extends CommonSendFetchAction {
  constructor() {
    super();

    this.moduleType = Constants.MODULE_TYPE.JIFENMALL;
    this.name = "JifenMallChoujiangAction";
  }

  _dealFinishSucess(data, response) {
    this.caller.setState({luckData:data});
    if(this.caller.zhuanpan != undefined)
    {
      this.caller.zhuanpan();
    }
  }

  _dealFinishFailed(data, response) {
    let detail = "服务器错误";
    if(data && data.detail != undefined) {
      detail = data.detail;
    }
    detail += " " + response.status;
    if(response.status === ResponseConstants.status_service_unavailable) {
      detail = "该功能维护中，请稍候再试";
    }
    this.caller.setState({
      viewStatus:response.status,
      statusText:detail,
    })
  }
}
